import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.async.AxisCallback;
import org.apache.axis2.rpc.client.RPCServiceClient;

import zhj.AxisCallbackTest;

public class HelloWorldClient {
	public static void main(String[] args) throws AxisFault {
		// RFC的调用方式
		RPCServiceClient client = new RPCServiceClient();
		Options option = client.getOptions();

		String address = "http://localhost:8082/axis2/services/HelloWorld?wsdl";
		EndpointReference epf = new EndpointReference(address);
		option.setTo(epf);

		QName qname = new QName("http://ws.apache.org/axis2", "sayHello");
		// 指定调用的方法和传递参数数据，及设置返回值的类型
		Object[] result = new Object[10];
		try
		{
			result = client.invokeBlocking(qname, new Object[] { "jack" },
				new Class[] { String.class });
		}
		catch(Exception e)	
		{
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}
		System.out.println(result[0]);

		qname = new QName("http://ws.apache.org/axis2", "execute");
		result = client.invokeBlocking(qname,new Object[]{"111"},new Class[]{String.class} );
		System.out.println(result[0]);
		
		qname = new QName("http://ws.apache.org/axis2", "execute");
		//result = client.invokeBlocking(qname, new Object[]{"123"},new Class[]{String.class}); 
		

	}
	
}
